package com.bwie.ticket.controller;

import com.bwie.common.domain.Order;
import com.bwie.common.domain.Ticket;
import com.bwie.common.result.Result;
import com.bwie.ticket.service.TickerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping()
public class TicketController {
    @Autowired
    private TickerService tickerService;

    @PostMapping("list")
    public Result<List<Ticket>> list(){
        List<Ticket> list=tickerService.list();
        return Result.success(list);
    }

    @PostMapping("add")
    public Result add(@RequestBody Ticket ticket){
        Result result = tickerService.add(ticket);
        return result;
    }

    @PostMapping("selectOrder")
    public Result<List<Order>> selectOrder(){
        List<Order> order = tickerService.selectOrder();
        return Result.success(order);
    }
}
